home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / lzrtpu.zip / LZRTPU.DOC < prev    next >
Text File  |  1990-10-19  |  4KB  |  104 lines

  1. The LASERPRT.PAS file produces a unit which is used for
  2. printing reports with a HP LaserJet or compatible printer.
  3. Most of the commonly used formatting commands have been
  4. provided as functions.  Each function returns a string
  5. containing the appropriate HP PCL control codes.  It is
  6. anticipated that the function calls would be made within a
  7. "WRITE(lst," or a "WRITELN(lst," statement.
  8.  
  9. One of the most difficult problems I had in trying to format
  10. my printouts was using the shading feature to shade every
  11. other line.  Ted Dickens, Sysop of the HP Forum (76701,272)
  12. figured out the right way to accomplish this task.  The
  13. following is an edited version of several messages he wrote
  14. explaining how this is accomplished.  In addition, the
  15. sample program included in the LZRTPU.ZIP file
  16. (SHADETXT.PAS) was originally written by Ted to demonstrate
  17. this procedure.  I have modified it to take advantage of the
  18. LASERPRT.TPU functions.
  19.  
  20. ============================================================
  21. There are three different ways to position the cursor on a
  22. LaserJet+ (or later): row/col, dot/dot, and
  23. decipoint/decipoint.  The three are not interchangeable.
  24.  
  25. For the sake of this discussion, assume the top margin is 0
  26. lines and that the left unprintable margin is 0.25 inches.
  27.  
  28. The decipoint/decipoint control sequence, <esc>&a720v1440H,
  29. says move the cursor to 1" (720/720) from the top edge and
  30. 2.25" (1440/720 + 0.25" unprintable region) from the left
  31. edge.
  32.  
  33. The dot/dot control sequence, <esc>*p300y600X, does exactly
  34. the same thing.  With either command, the cursor will be
  35. positioned exactly 1" from the top of the paper and 2.25"
  36. from the left edge.  If you were to draw a single dot --
  37. that's where it would appear.
  38.  
  39. But, even though there are 10 characters per inch and 6 rows
  40. per inch, the row/col control sequence, <esc>&a6r20C, will
  41. NOT leave the cursor at the same position.
  42.  
  43. The cursor WILL be left 2.25" from the left edge.  But the
  44. vertical spacing will be at 6.75 rows from the top -- not 6
  45. as one might think.
  46.  
  47. There's a pretty good reason for this.  Think of a character
  48. cell:
  49.        +-------+
  50.        |       |
  51.        |       |
  52.        |       |  /______ Baseline is set to 75%
  53.        |       |  \       of the current VMI setting
  54.        +-------+
  55.  
  56. This little extra nudge moves the cursor so that the top of
  57. the character cell will fall at the specified location.  In
  58. this example -- the TOP of the first character we print
  59. should appear 1" from the top edge and 2.25" from the left
  60. edge.
  61.  
  62. In fact, the only time that the difference is even noticed
  63. is when mixing text and graphics.  (Shading is a graphic
  64. function on the LaserJets.)
  65.  
  66. Therefore, when shading a line of text, the shading
  67. procedure should:
  68.  
  69. 1. move the cursor up 75 percent of the height of the
  70.    current line height;
  71.  
  72. 2. fill the desired area;
  73.  
  74. 3. move the cursor down 75 percent of the height of the
  75.    current line height;
  76.  
  77. 4. print the line of text.
  78.  
  79. Thus, the up and down cursor movements are:
  80.  
  81.              Line Height       Movement
  82.    lpi       (decipoints)    (decipoints)
  83. ---------    ------------    ------------
  84.     4           180              135
  85.     6           120               90
  86.     8            90               67.5
  87.  
  88. (line height = (1 inch/X lpi)*(720 decipoints per inch)
  89. ============================================================
  90.  
  91. The principles discussed above are used in three sample
  92. programs.  The first (SHADETXT.PAS) is included in the
  93. LZRTPU.ZIP file.  The other two (SHADE1.PAS and SHADE2.PAS)
  94. are available in Library 0 of the HP forum.  SHADETXT.PAS is
  95. a sample program showing alternating lines of shaded text.
  96. SHADE1.PAS produces a pattern similar to "green bar" paper
  97. in the portrait format while SHADE2.PAS does the same thing
  98. except in the landscape format.
  99.  
  100. By the way, if you browse the HP library, you will see a
  101. SHADE3.PAS file.  That is the original version of the
  102. SHADETXT.PAS program.
  103.  
  104.